﻿@*
    For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    ViewData["Title"] = "View";
}
<div id="layout" class="easyui-layout" data-options="fit:true" style="width:100%;height:100%">
    <div data-options="region:'north'" style="height:50px;"></div>
    <div data-options="region:'center'">
        <table id="dg" style="width:100%;height:100%;"></table>
    </div>
</div>
<script>
    $(function () {

        $("#dg").datagrid({
            pagination:false,
            columns: [[
                { field: 'itemid', title: 'Item ID', width: 80 }
            ]]
        });

        $.ajax({
            method: "GET",
            url: "../user",/*此处为什么用当前目录呢？应为当前的url的实际内容，已经被前台处理了增加了一级目录[/user],*/
            headers: { 'authorization': "Bearer " + localStorage.getItem('token') },
            dataType: "json",
            data: { "num": 1000 },
            success: function (data) {
                console.info(data);
                $("#dg").datagrid("loadData", data);
            },
            error: function (e) {
                console.info(e);
            }
        });
    });
</script>